package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.service.wx.WXStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Can
 * @since 2022/06/29 15:22
 */
@RestController
@RequestMapping("wx/storage")
public class WXStorageController {
    @Autowired
    WXStorageService wxStorageService;

    /**
     * wx上传图片
     * 暂时和网页端保存路径一致
     *
     * @param file
     * @return com.cskaoyan.bean.vo.BaseRespVo
     * @author Can
     * @since 2022/06/29 15:34
     */
    @RequestMapping("upload")
    public BaseRespVo uploadImage(@RequestParam MultipartFile file) {
        BaseRespVo respVo = null;
        if (!file.isEmpty()) {
            respVo = wxStorageService.uploadImage(file);
        }
        return respVo;
    }
}
